package controller;

import config.Interceptor.PassToken;
import entity.Userdebils;
import mapper.UserdebilsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import service.impl.UserdeblisServiceimpl;
import utils.CommonRetumType;

import javax.annotation.Resource;

@RestController
@RequestMapping("/userdebils")
public class Userdebilscontroller {
    @Autowired
    UserdeblisServiceimpl userdeblisServiceimpl;


    @PostMapping("/registerdebils")
    @PassToken
    public CommonRetumType registerdebils(@RequestParam(value="name",required = true) String name,
                                          @RequestParam(value="sex",required = true) String sex,
                                          @RequestParam(value="email",required = true) String email,
                                          @RequestParam(value="phone",required = true) Integer phone)

    {
        Userdebils userdebils = new Userdebils();
        userdebils.setName(name);
        userdebils.setSex(sex);
        userdebils.setEmail(email);
        userdebils.setPhone(phone);
        return CommonRetumType.create(userdeblisServiceimpl.insertSelective(userdebils),"用户详情添加成功");
    }
}
